﻿using Volo.Abp.Settings;
using Xms.Abp.Emailing.Localization;
using Xms.Abp.Settings;

namespace Xms.Abp.Emailing;

[SettingsDefinition(TenantSettingValueProvider.ProviderName, typeof(EmailingResource))]
public class EmailSettings : SettingsBase
{
    #region Smtp
    public string SmtpHost => GetValue();
    [SettingValue("22")]
    public int SmtpPort => GetValue<int>();
    public string SmtpUserName => GetValue();
    public string SmtpPassword => GetValue();
    public string SmtpDomain => GetValue();
    public bool SmtpEnableSsl => GetValue<bool>();
    [SettingValue("true")]
    public bool SmtpUseDefaultCredentials => GetValue<bool>();
    [SettingValue("true")]
    public bool SmtpEnable => GetValue<bool>();
    #endregion

    #region From
    public string DefaultFromAddress => GetValue();
    public string DefaultFromDisplayName => GetValue();
    #endregion

    [SettingValue("Smtp")]
    public string DefaultProvider => GetValue();

    public bool GetProviderEnableValue(string providerName)
    {
        return GetValue<bool>(providerName + "Enable");
    }

    public bool IsForwordEnabled => GetValue<bool>();

    public SettingsDictionary<string> Forwords => GetDictionary();
}
